<template>
	<view class="page-content">
		<view class="title">
			当前汇率：{{txhuilv}}
		</view>
		<view class="content">
			<view class="label">
				提现数量（代币）
			</view>
			<view class="input">
				<uni-number-box v-model="num" :max="100000" background="#2979FF" color="#fff"></uni-number-box>
			</view>
		</view>
		<view class="footer">
			实际到账(USDT):{{totaltxhuilv}}
		</view>
		<view class="btn-sub">
			<button type="primary" @click="handleBtn">提交</button>
		</view>
	</view>
</template>

<script setup>
	import {
		computed,
		onMounted,
		ref
	} from 'vue';
	import {
		SetAPI
	} from '../../apis/user';
	import {
		useMemberStore
	} from '../../stores';
	const num = ref(100)
	const txhuilv = ref(0)
	const totaltxhuilv = computed(() => {
		return (num.value / txhuilv.value).toFixed(2)
	})
	const userStore = useMemberStore()
	const handleBtn = (() => {
		if (!num.value) {
			uni.showModal({
				title: '提示',
				content: '代币不能为空'
			})
		}
	})
	onMounted(async () => {
		const {
			data
		} = await SetAPI()
		txhuilv.value = data.txhuilv
	})
</script>

<style lang="scss">
	.page-content {
		padding: 20upx;

		.title {
			padding: 20upx 0;
		}

		.content {
			display: flex;
			padding: 20upx 0;
			justify-content: space-between;

		}

		.footer {
			padding: 20upx 0;
		}

		.btn-sub {
			margin-top: 40upx;
		}
	}
</style>